package com.cy.service.tborderservice;

import com.cy.dao.TborderDao;
import com.cy.pojo.Tborder;
import com.cy.service.Tborderservice;
import com.cy.util.JsonRueslt;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TborderServiceImpl implements Tborderservice {
    @Autowired
    TborderDao tborderDao;
    @Override
    public List<Tborder> sele(Tborder tborder) {
        int length1 = new JsonRueslt(tborderDao.selectall( tborder)).getData().toString().length();
        if(length1==2) throw new RuntimeException("你查询的数据不存在");
        return tborderDao.selectall( tborder);

    }

    @Override
    public int ins(Tborder tborder) {
        return tborderDao.in(tborder);
    }

    @Override
    public int upd(Tborder tborder) {
        int length = tborder.toString().length();
        if (length==146) throw new RuntimeException("参数为空");
        return tborderDao.up(tborder);
    }

    @Override
    public int del(Long[] ids) {
        if(ids==null) throw new RuntimeException("参数为空");
        return tborderDao.de(ids);
    }
}
